<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateEntryorderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('entryorders', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('customer_id')->comment('客户ID');
            $table->char('code', 12)->unique()->comment('入库仓单号');
            $table->string('foreign')->comment('客户入库单号');
            $table->date('expect_at')->comment('预计到货日期');
            $table->char('status', 3)->default(0)->comment('状态');
            $table->timestamps();

            $table->unique(['customer_id', 'foreign']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('entryorders');
    }
}
